package cn.risebd.wepay.core;

/**
 * Wepay构建器 @author 喝咖啡的蚂蚁  Date: 25/11/15
 * 
 * @since 1.0.0
 */
public final class WepayBuilder {

	private Wepay wepay;

	private WepayBuilder() {
	}

	public static WepayBuilder newBuilder(String appId, String appKey, String mchId) {
		WepayBuilder builder = new WepayBuilder();
		builder.wepay = new Wepay(appId, appKey, mchId);
		return builder;
	}

	/**
	 * 设置证书密码
	 * 
	 * @param certPasswd
	 *            证书密码
	 * @return this
	 */
	public WepayBuilder certPasswd(String certPasswd) {
		wepay.certPasswd = certPasswd;
		return this;
	}

	/**
	 * 设置证书数据(p12文件)
	 * 
	 * @param certs
	 *            二进制数据
	 * @return this
	 */
	public WepayBuilder certs(byte[] certs) {
		wepay.certs = certs;
		return this;
	}

	public Wepay build() {
		return wepay.init();
	}
}
